package com.eduhzy.ttw.clazz.di.module;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.eduhzy.ttw.clazz.R;
import com.eduhzy.ttw.clazz.mvp.contract.EditGroupContract;
import com.eduhzy.ttw.clazz.mvp.model.EditGroupModel;
import com.eduhzy.ttw.clazz.mvp.model.entity.EditGroupData;
import com.eduhzy.ttw.clazz.mvp.ui.adapter.GroupSectionAdapter;
import com.jess.arms.di.scope.ActivityScope;

import java.util.ArrayList;
import java.util.List;

import dagger.Module;
import dagger.Provides;

/**
 * @author xubo
 * @date 2018-12-6 16:33:20
 */
@Module
public class EditGroupModule {
    private EditGroupContract.View view;

    /**
     * 构建EditGroupModule时,将View的实现类传进来,这样就可以提供View的实现类给presenter
     *
     * @param view
     */
    public EditGroupModule(EditGroupContract.View view) {
        this.view = view;
    }

    @ActivityScope
    @Provides
    EditGroupContract.View provideEditGroupView() {
        return this.view;
    }

    @ActivityScope
    @Provides
    EditGroupContract.Model provideEditGroupModel(EditGroupModel model) {
        return model;
    }

    @ActivityScope
    @Provides
    List<EditGroupData> provideLists() {
        return new ArrayList<>();
    }
    @ActivityScope
    @Provides
    RecyclerView.LayoutManager provideLayoutManager(){
        return new GridLayoutManager(view.getActivity(),4);
    }
    @ActivityScope
    @Provides
    GroupSectionAdapter provideAdapter(List<EditGroupData>lists){
        return new GroupSectionAdapter(R.layout.clazz_rv_item_choose_item, R.layout.clazz_rv_item_choose_group,lists);
    }

}